package com.imooc.article.task;

import com.imooc.article.service.ArticleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;

import java.time.LocalTime;

//@Configuration
//@EnableScheduling
public class TaskPublicArticles {
    @Autowired
    private ArticleService articleService;


    @Scheduled(cron = "0/5 * * * * ? ")
    private void publishArticles() {
        System.out.println("当前时间是: "+LocalTime.now());
        articleService.updateOppiontToPublic();
    }
}
